package chapter06;

public class Java05_Exception {
    public static void main(String[] args) {
        // TODO 异常
        // 5.格式化异常：java.lang.NumberFormatException
        // 运行期异常
        String s = "123";
        //Integer i = (Integer)s;
        Integer i = Integer.parseInt(s);
        System.out.println(i);
        System.out.println("-----------------------");
        String s1 = "a123";
        //Integer i = (Integer)s;
        //Integer i1 = Integer.parseInt(s1);
        //System.out.println(i1);

        System.out.println("-----------------------");

        // 6.类型转换错误：java.lang.ClassCastException
        // 运行期异常
        Object obj = new User5();
        if (obj instanceof Emp5) {
            Emp5 emp = (Emp5)obj;
        }

    }
}
class User5{

}
class Emp5{

}